//package chatRoom.com.fenwe.service.impl;
//
//import java.util.List;
//
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//import org.springframework.web.servlet.support.RequestContextUtils;
//
//import chatRoom.com.fenwe.controller.data.QueryFriendRequest;
//import chatRoom.com.fenwe.controller.data.QueryUserRequest;
//import chatRoom.com.fenwe.dao.UserDAO;
//import chatRoom.com.fenwe.dao.UserFriendDAO;
//import chatRoom.com.fenwe.dao.entity.UserCriteria;
//import chatRoom.com.fenwe.dao.entity.UserDO;
//import chatRoom.com.fenwe.service.IUserService;
//import chatRoom.com.fenwe.util.CodeCreateUtil;
//import chatRoom.com.fenwe.util.RequestValidateUtil;
//import chatRoom.com.fenwe.util.exception.ServiceException;
//
//@Service
//public class UserServiceImpl implements IUserService {
//    private static Logger logger = LoggerFactory.getLogger(UserServiceImpl.class);
//    @Autowired
//    private UserDAO userDAO;
//    @Autowired
//    private UserFriendDAO userFriendDAO;
//
//    public List<UserDO> queryFriends(QueryFriendRequest queryFriendRequest) throws Exception {
//        RequestValidateUtil.resolveCommonClass(queryFriendRequest);
//        UserCriteria userCriteria = new UserCriteria();
//        userCriteria.setName(queryFriendRequest.getName());
//        return userFriendDAO.selectByCriteria(userCriteria);
//    }
//
//    public UserDO queryUser(QueryUserRequest queryUserRequest) throws Exception {
//        RequestValidateUtil.resolveCommonClass(queryUserRequest);
//        UserCriteria userCriteria = new UserCriteria();
//        userCriteria.setName(queryUserRequest.getName());
//        List<UserDO> userDOs = userDAO.selectByCriteria(userCriteria);
//        if (userDOs == null || userDOs.size() < 1) {
//            logger.error(CodeCreateUtil.createLogMessage("UserServiceImpl.queryUser",
//                    "根据用户名查询用户信息[根据用户姓名" + queryUserRequest.getName() + "查询用户为空]"));
//            throw new ServiceException("查询用户失败，请重试！");
//        }
//        if (userDOs.size() > 1) {
//            logger.error(CodeCreateUtil.createLogMessage("UserServiceImpl.queryUser",
//                    "根据用户名查询用户信息[根据用户姓名" + queryUserRequest.getName() + "查询到用户" + userDOs.size() + "个]"));
//            throw new ServiceException("查询用户失败，请重试！");
//        }
//        return userDOs.get(0);
//    }
//
//}
